/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ericsson.nfc.signing.algorithm;

import com.ericsson.nfc.signing.record.CertificateBytes;
import com.ericsson.nfc.signing.record.URIRecord;

//#ifdef MyJSR257
//# import my.javax.microedition.contactless.ndef.NDEFRecordType;
//#else
import javax.microedition.contactless.ndef.NDEFRecordType;
//#endif

/**
 *
 * @author emarkki
 */
public abstract class Signer {

    private int algorithm;
    private PrivateKey privateKey;
    private int certificateType;
    private CertificateBytes[] certificateChain;
    private URIRecord certificateURI;
    private NDEFRecordType signatureRecordType;

    /**
     * 
     * @param algorithm
     * @param privateKey
     * @param certificateType
     * @param chain
     * @param certURI
     * @throws WrongPrivateKeyAlgorithm
     */
    public Signer(int algorithm, PrivateKey privateKey, int certificateType, CertificateBytes[] chain, URIRecord certURI, NDEFRecordType signatureRecordType) {
        this.algorithm = algorithm;
        this.privateKey = privateKey;
        this.certificateType = certificateType;
        this.certificateChain = chain;
        this.certificateURI = certURI;
        this.signatureRecordType = signatureRecordType;
    }

    public abstract byte[] sign(byte[] coveredBytes) throws SignatureException;

    public int getAlgorithm() {
        return algorithm;
    }

    public int getCertificateType() {
        return certificateType;
    }

    public CertificateBytes[] getCertificateChain() {
        return certificateChain;
    }

    public URIRecord getCertificateURI() {
        return certificateURI;
    }

    public PrivateKey getPrivateKey() {
        return privateKey;
    }

    public NDEFRecordType getSignatureRecordType() {
        return signatureRecordType;
    }

}
